package test00.lx09.demo01;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Stream;

/**
 * @author CSY
 * @date 2025 - 04 - 08
 */
public class MainTest {
    public static void main(String[] args) {
        /*List<Integer> list = Arrays.asList(1,5,6,2,3,8,4);
        for (int i = 0; i < list.size(); i++) {
            for (int j = i+1; j < list.size(); j++) {
                if(list.get(i) > list.get(j)) {
                    int temp = list.get(i);
                    int temp2 = list.get(j);
                    list.set(i, temp2);
                    list.set(j, temp);
                }
            }
        }
        System.out.println(list);*/

        Class<UserService> clazz = UserService.class;
        Method[] declaredMethods = clazz.getDeclaredMethods();
        Stream<Method> stream = Arrays.stream(declaredMethods);
        stream.filter(t -> t.isAnnotationPresent(Order.class))
                .sorted((o1,o2)-> o1.getAnnotation(Order.class).value() - o2.getAnnotation(Order.class).value())
                .map(Method::getName)
                .forEach(System.out::println);
    }
}
